package com.heima.wemedia.feign;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmNewsDto;
import com.heima.wemedia.service.GreenScanService;
import com.heima.wemedia.service.WmChannelService;
import com.heima.wemedia.service.WmNewsAutoScanService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
public class WemediaClient implements IWemediaClient {

    @Autowired
    private WmChannelService wmChannelService;

    @Autowired
    private WmNewsAutoScanService wmNewsAutoScanService;

    @GetMapping("/api/v1/channel/list")
    @Override
    public ResponseResult getChannels() {
        return wmChannelService.findAll();
    }

    @Override
    @PostMapping("/scan")
    public Boolean scanText(@RequestParam("text") String text) {
        return wmNewsAutoScanService.scanTextOnly(text);
    }


    /**
     * 频道查询
     * @return
     */
    @GetMapping("/api/v1/channel/channels")
    public ResponseResult findAll() {
        return wmChannelService.findAll();
    }


}